<template>
  <div class="history">
    <h4>历史记录：</h4>
    <div class="his-item" v-for="item in searchList" :key="item.time" @click="search(item.value)">{{item.value}}</div>
  </div>
</template>

<script>
export default {
  props: {
    searchList: {
      default () {
        return [];
      }
    }
  },
  methods: {
    search (value) {
      this.$emit('search', value);
    }
  }
}
</script>

<style scoped lang="less">
  .history {
    h4 {
      margin: 20px 0 10px;
      color: #999;
    }
  }
  .his-item {
    padding: 5px 10px;
    background-color: #eee;
    border-radius: 5px;
    margin-left: 10px;
    margin-bottom: 10px;
    display: inline-block;
  }
</style>
